/**
 * 用户相关类型定义
 */

// 用户信息
export interface User {
  id: number
  username: string
  name: string
  nickname: string
  thumb: string
  sex: number
  mobile: string
  phone: string
  email: string
  did: number
  department_ids: string
  position_id: number
  type: number
  status: number
  entry_time: string
  reg_pwd: string
  salt: string
  pwd: string
  last_login_time: string
  last_login_ip: string
  create_time: number
  update_time: number
  // 扩展字段
  department?: string
  position?: string
  departments?: string
  pname?: string
  department_names?: string
}

// 用户信息（简化版，用于登录后显示）
export interface UserInfo {
  id: number
  username: string
  nickname: string
  avatar: string
  department?: string | null
  position?: string | null
  create_time?: string
  menu?: any[] | null
}

// 部门信息
export interface Department {
  id: number
  pid: number
  title: string
  leader_ids: string
  sort: number
  remark: string
  status: number
  create_time: number
  update_time: number
  // 扩展字段
  leader?: string
  children?: Department[]
}

// 岗位信息
export interface Position {
  id: number
  title: string
  remark: string
  status: number
  create_time: number
  update_time: number
  // 扩展字段
  groupName?: string
  group_id?: number[]
}

// 登录参数
export interface LoginCredentials {
  username: string
  password: string
  captcha?: string
  captchaId?: string
}

// 登录响应
export interface LoginResponse {
  token: string
  user_info: User
  menu: any[]
}
